//
//  NemoWhiteboardView.h
//  NemoSDKDemo
//
//  Created by NemoSDKDemo on 19/5/27.
//  Copyright © 2019年 ainemo. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>
#import "NemoDrawingCommand.h"

typedef NS_OPTIONS(NSUInteger, RemoteLineFlag)
{
    REMOTE_LINE_FLAG_NONE         = 0,
    REMOTE_LINE_FLAG_IS_GET_ALL   = 1 << 0,
    REMOTE_LINE_FLAG_SAVE_ONLY    = 1 << 1,
    REMOTE_LINE_FLAG_IS_START     = 1 << 2,
    REMOTE_LINE_FLAG_IS_FINISH    = 1 << 3
};

typedef NS_ENUM(NSInteger, NemoWhiteboardStatus)
{
    NemoWhiteboardStatus_Opening,
    NemoWhiteboardStatus_Opened,
    NemoWhiteboardStatus_Error, // 错误
};

@class NemoWhiteboardView;
@protocol WhiteboardDelegate <NSObject>

-(void)didDrawLineInWhiteboard:(NemoWhiteboardView*)wbView
                         Color:(UIColor*)color
                         width:(CGFloat)width
                        points:(NSArray*)pointArray
                       isStart:(BOOL)isStart
                      isFinish:(BOOL)isFinish;

-(void)didClearedInWhiteboard:(NemoWhiteboardView*)wbView;

-(void)didUndoInWhiteboard:(NemoWhiteboardView*)wbView seqId:(int)seqId;

-(void)didRedoInWhiteboard:(NemoWhiteboardView*)wbView seqId:(int)seqId;

@end

@interface NemoWhiteboardView : UIView

@property (nonatomic, weak) IBOutlet UIView *drawingContainer;
@property (nonatomic, weak) IBOutlet GLKView *drawingView;

@property (nonatomic, weak) IBOutlet UIView *dimingView;

@property (nonatomic, weak) IBOutlet UIView *toolbarView;
@property (nonatomic, weak) IBOutlet UIView *buttonContainer;
@property (nonatomic, weak) IBOutlet UIButton *pencilBtn;
@property (nonatomic, weak) IBOutlet UIButton *highlightBtn;
@property (nonatomic, weak) IBOutlet UIButton *eraserBtn;
@property (nonatomic, weak) IBOutlet UIButton *clearBtn;
@property (nonatomic, weak) IBOutlet UIButton *colorBtn;
@property (nonatomic, weak) IBOutlet UIView *colorContainer;
@property (nonatomic, weak) IBOutlet UIButton *color1Btn;
@property (nonatomic, weak) IBOutlet UIButton *color2Btn;
@property (nonatomic, weak) IBOutlet UIButton *color3Btn;
@property (nonatomic, weak) IBOutlet UIButton *color4Btn;
@property (nonatomic, weak) IBOutlet UIButton *cancelColorBtn;

@property (nonatomic, assign) id<WhiteboardDelegate> whiteboardDelegate;

@property (nonatomic, assign) NemoWhiteboardStatus status;

-(IBAction)tapToolBtn:(id)sender;
-(IBAction)tapColorBtn:(id)sender;
-(IBAction)tapClearBtn:(id)sender;
-(IBAction)selectColor:(id)sender;
-(IBAction)cancelColorSelect:(id)sender;

+ (NemoWhiteboardView *)whiteboardView;

-(id)initWithFrame:(CGRect)frame ;

-(void)setCanvasAspect:(CGFloat)aspect;

-(void)drawLineWithSequenceId:(int)seqId
                        color:(UIColor*)color
                        width:(CGFloat)width
                       points:(NSArray*)pointArray
                     lineFlag:(RemoteLineFlag)flag;

-(void)undoWithSeqId:(int)seqId;

-(void)clear;

-(void)redoWithSeqId:(int)seqId;

@end
